package block.field;

/**
 * Created with IntelliJ IDEA.
 * ClassName: FieldTest
 * Package: block.field
 * Description:
 * User: fzykd
 *
 * @Author: LQH
 * Date: 2023-11-23
 * Time: 19:47
 */

//测试属性赋值的先后顺序
public class FieldTest {

    public static void main(String[] args) {
        Order o1 = new Order();
        System.out.println(o1.orderId);
    }

}

class Order {


    //没报错 是因为在赋值一之前 已经加载过了 已经是存在的了
    {
        orderId = 2;
    }

    int orderId = 1;


    public Order() {
        orderId = 3;
    }

    public void eat(){

    }

}
